var http =require("http");

var data= [];

var server = http.createServer(function(req,res){
	if(req.url.startsWith("/login")){
		var str =req.url.split("?");
                str = str[1];
                var arr =str.split("&");
                var one ={};
                arr.forEach(function(o){
                        var s= o.split("=");
                        one[s[0]]=s[1];
                        });
                data.push(one);
                console.log(data);
		if(one.name=="lms"&&one.pass=="123"){
		res.setHeader("Content-Type","text/html");
		res.end("登录成功");
		}
		else{
	res.setHeader("Content-Type","text/html");
		res.end("登录失败")
		}
	}		
		else if (req.url.startsWith("/reg")){
	
		}

});
server.listen(3000); 
